//
//  CoinExchangeRecordTableCell.m
//  TenMinDemo
//
//  Created by Shawn Li on 2021/3/8.
//  Copyright © 2021 CYXiang. All rights reserved.
//

#import "CoinExchangeRecordTableCell.h"
#import <UIImageView+WebCache.h>
#import "DateTool.h"
#import "NSString+FloatString.h"
@interface CoinExchangeRecordTableCell()
@property (weak, nonatomic) IBOutlet UILabel *optTitle;
@property (weak, nonatomic) IBOutlet UILabel *time;
@property (weak, nonatomic) IBOutlet UILabel *info;
@property (weak, nonatomic) IBOutlet UIImageView *icon;
@end
@implementation CoinExchangeRecordTableCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)refreshModel:(TransferLogItem *)model{
    BOOL isSend = [model.type isEqualToString:@"SEND"];
    [self.icon sd_setImageWithURL:[NSURL URLWithString:model.iconUrl]];
    self.optTitle.text = isSend ? LCLocalString(@"transfer_out") : LCLocalString(@"transfer_in");
    
    NSString *infoStr = [NSString stringWithFormat:@"%@%@",(isSend?@"-":@"+"),[[NSString stringWithFormat:@"%@",@(model.amount)] floatString]];
    UIColor *infoColor = isSend ? LRRGBColor(146, 154, 204) : LRRGBColor(147, 91, 255);
    
    NSMutableAttributedString *info = LCAttStr(infoStr, [UIFont systemFontOfSize:16 weight:(UIFontWeightMedium)], infoColor);
//    NSString *symStr = [NSString stringWithFormat:@" %@",model.assetSymbol];
//    ;
    
    [info appendAttributedString:LCAttStr(([NSString stringWithFormat:@" %@",model.assetSymbol]), [UIFont boldSystemFontOfSize:10], [UIColor colorWithHexString:@"#5f658b"])];
    self.info.attributedText = info;
    
    self.time.text = [DateTool timeStrWithTime:model.txTime];
}

@end
